package com.longge;

public class AreaOfMaxDiagonal {

    public int areaOfMaxDiagonal(int[][] dimensions) {

        int ans = 0, sqrt = -1;
        for (int[] dimension : dimensions) {
            int nextSqrt = dimension[0] * dimension[0] + dimension[1] * dimension[1];
            if (nextSqrt == sqrt) {
                ans = Math.max(ans, dimension[0] * dimension[1]);
            } else if (nextSqrt > sqrt) {
                sqrt = nextSqrt;
                ans = dimension[0] * dimension[1];
            }
        }

        return ans;
    }
}
